package com.foreknow.demo13;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author shkstart
 * @create 2021-08-02 15:46
 */
public class StuIOTest {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        List<Student> list=new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            System.out.println("请输入学生信息");
            String id = sc.next();
            String name = sc.next();
            int age = sc.nextInt();
            String school = sc.next();
            list.add(new Student(id,name,age,school));
        }

        //调用write方法
        ReWrDo r1=new ReWrDo();
        r1.writer(list,"Student.txt");

        List<Student> read = r1.read("Student.txt");
        for (int i = 0; i < read.size(); i++) {
            System.out.println(read.get(i));

        }

    }
}
